package org.yuanqiframework.yuanqi.web.entity;

import lombok.Data;

import java.util.HashMap;
import java.util.Map;

@Data
public class AjaxResultBuilder<T> {

    private Map<String, Object> map;
    private AjaxResult<Map<String, Object>> ajaxResult;


    public AjaxResultBuilder() {
        map = new HashMap<>();
        ajaxResult = AjaxResult.success(map);
    }

    public static <T> AjaxResultBuilder<T> newInstance() {
        return new AjaxResultBuilder<>();
    }

    public AjaxResultBuilder<T> put(String k, Object v) {
        map.put(k, v);
        return this;
    }

    public AjaxResult<Map<String, Object>> build() {
        return ajaxResult;
    }
}
